{% load static %}
{% load i18n %}
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>云管平台</title>
    <link rel="shortcut icon" href="{{ FAVICON_URL }}" type="image/x-icon">
    {% include '_head_css_js.html' %}
    <link href="{% static "css/jumpserver.css" %}" rel="stylesheet">
    <script type="text/javascript" src="{% url 'javascript-catalog' %}"></script>
    <script src="{% static "js/jumpserver.js" %}"></script>
    <style>
        .captcha {
             float: right;
         }
        .wrapper {
            position: absolute;
            left: 50%;
            top: 50%;
            margin-left: -140px;
            margin-top: -200px;
            width: 380px;
            height: 340px;

        }
        .col-md-6 {
            width: 100%;
    }
    </style>
</head>

<body class="gray-bg">
    <div class="wrapper">
        <div class="col-md-6">
            <div class="ibox-content">
                <div>
                    <img src="{{ LOGO_URL }}" width="60" height="60">
        <span class="font-bold text-center" style="font-size: 24px; font-family: inherit; margin-left: 20px">{% trans 'Login' %}</span><hr>
    <p class="font-bold text-center" style="font-size: 14px; font-family: inherit; color: #f44; text-align: center;">为了账户安全, 请进行二次验证</p>
    </div>
    <form class="m-t" role="form" method="post" action="">
        {% csrf_token %}

    {% if block_login %}
    <p class="red-fonts">{% trans 'Log in frequently and try again later' %}</p>
    {% elif password_expired %}
    <p class="red-fonts">{% trans 'The user password has expired' %}</p>
    {% elif form.errors %}
    {% if 'captcha' in form.errors %}
    <p class="red-fonts">{% trans 'Captcha invalid' %}</p>
    {% else %}
    <p class="red-fonts">{{ form.non_field_errors.as_text }}</p>
    {% endif %}
    <p class="red-fonts">{{ form.errors.password.as_text }}</p>
    {% endif %}
    <div class="form-group">
        <input type="text" class="form-control" name="{{ form.username.html_name }}" placeholder="{% trans 'Username' %}" required="" value="{% if form.username.value %}{{ form.username.value }}{% endif %}">
        </div>
        <div class="form-group">
        <input type="password" class="form-control" name="{{ form.password.html_name }}" placeholder="{% trans 'Password' %}" required="">
        </div>
        <div>
        {{ form.captcha }}
    </div>
    <button type="submit" class="btn btn-primary block full-width m-b">{% trans 'Login' %}</button>

    {% if AUTH_OPENID %}
    <div class="hr-line-dashed"></div>
        <p class="text-muted text-center">{% trans "More login options" %}</p>
    <div>
    <button type="button" class="btn btn-default btn-sm btn-block" onclick="location.href='{% url 'authentication:openid:openid-login' %}'">
        <i class="fa fa-openid"></i>
    {% trans 'Keycloak' %}
    </button>
    </div>
    {% endif %}
    </form>

    </div>
    </div>
    </div>

</body>
</html>
